package o;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.appgallery.updatemanager.impl.service.KeyAppUpdateDownloadService;
import com.huawei.hmf.annotation.ApiDefine;
import com.huawei.hmf.annotation.Singleton;
import BaseDialog.a;
import o.czk.g;

@ApiDefine(uri = czp.class)
@Singleton
public class dab implements czp {
    private long ˊ = -1;
    private Boolean ˋ = null;
    private long ˎ = -1;
    private Boolean ˏ = null;
    private long ॱ = -1;
    private boolean ॱॱ = false;

    public boolean ˎ(Context context) {
        if (this.ˋ != null) {
            return this.ˋ.booleanValue();
        }
        this.ˋ = Boolean.valueOf(euf.ˎ().ˏ("is_need_auto_install", false));
        return this.ˋ.booleanValue();
    }

    public void ˋ(Context context, boolean z) {
        czi.ˎ.ˋ("UpdateControllerImpl", "setOpenPreUpdate : " + z);
        this.ˋ = Boolean.valueOf(z);
        euf.ˎ().ˋ("is_need_auto_install", z);
        Intent intent = new Intent();
        intent.setAction(ccv.ˋ());
        intent.setPackage(context.getPackageName());
        context.sendBroadcast(intent);
        ॱ(z);
    }

    public boolean ˏ(Context context) {
        if (this.ˏ != null) {
            return this.ˏ.booleanValue();
        }
        this.ˏ = Boolean.valueOf(euf.ˎ().ˏ("donot_disturb_flag", false));
        return this.ˏ.booleanValue();
    }

    public void ˏ(Context context, boolean z) {
        this.ˏ = Boolean.valueOf(z);
        euf.ˎ().ˋ("donot_disturb_flag", z);
    }

    public void ˎ(boolean z) {
        this.ॱॱ = z;
    }

    public boolean ˊ() {
        return this.ॱॱ;
    }

    public long ˋ(Context context) {
        if (this.ˊ == -1) {
            this.ˊ = new dax(context).ॱ("lastTime", 0);
        }
        return this.ˊ;
    }

    public void ˎ(Context context, long j) {
        this.ˊ = j;
        new dax(context).ˎ("lastTime", j);
    }

    public long ˊ(Context context) {
        if (this.ॱ == -1) {
            this.ॱ = new dax(context).ॱ("last_show_update_notify_time", 0);
        }
        return this.ॱ;
    }

    public void ˊ(Context context, long j) {
        this.ॱ = j;
        new dax(context).ˎ("last_show_update_notify_time", j);
    }

    public long ॱ(Context context) {
        if (this.ˎ == -1) {
            this.ˎ = new dax(context).ॱ("lastTime_keyUpdate", 0);
        }
        return this.ˎ;
    }

    public void ॱ(Context context, long j) {
        this.ˎ = j;
        new dax(context).ˎ("lastTime_keyUpdate", j);
    }

    public void ʼ(Context context) {
        dau.ˎ(context);
    }

    public int ˋ(String str) {
        Object ॱ = euf.ˎ().ॱ("show_update_times", "");
        if (!TextUtils.isEmpty(ॱ)) {
            String[] split = ॱ.split(str);
            if (2 == split.length) {
                String str2 = split[1];
                try {
                    return Integer.parseInt(str2);
                } catch (NumberFormatException e) {
                    czi.ˎ.ˊ("UpdateControllerImpl", "can not change to int:" + str2);
                }
            }
        }
        return 0;
    }

    public void ˊ(String str, int i) {
        euf.ˎ().ˋ("show_update_times", str + i);
    }

    public void ॱ(Context context, czt o_czt, cke o_cke) {
        dag.ˊ(context, o_czt, o_cke);
    }

    public PendingIntent ˊ(Context context, String str) {
        Intent intent = new Intent(context, KeyAppUpdateDownloadService.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable(KeyAppUpdateDownloadService.KEY_APP_UPDATE_DOWNLOAD_PRARM_PKG, str);
        bundle.putInt(KeyAppUpdateDownloadService.DOWNLOAD_COMMAND, 1);
        intent.putExtras(bundle);
        return PendingIntent.getService(context, 1020, intent, 268435456);
    }

    public boolean ˋ() {
        return daj.ˎ().ॱ();
    }

    public void ˏ(boolean z) {
        dag.ˎ(z);
    }

    public void ᐝ(Context context) {
        evk.ˏ(context, g.ॱˊ, 0).ˋ();
    }

    public void ʻ(Context context) {
        BaseAlertDialog ˋ = BaseAlertDialog.ˋ(context, context.getResources().getString(g.ˎ), context.getResources().getString(g.ˈ));
        ˋ.ˏ(a.CONFIRM, 8);
        ˋ.ॱ();
        ˋ.ॱ(a.CANCEL, context.getResources().getString(g.ˋॱ));
    }

    private void ॱ(boolean z) {
        Context ˋ = ContentManager.getInstant().getContext();
        Intent intent = new Intent("com.huawei.appgallery.updatemanger.autoupdate.ACTION_NOTIFY_SWITCH_STATUS");
        intent.putExtra("isSwitchOn", z);
        ll.ˏ(ˋ).ˋ(intent);
    }
}
